package org.example.utils;

import java.util.Calendar;
import java.util.Date;

public class DateUtils {
    /**
     * 添加N分钟
     * @param addMinutes
     * @return
     */
    public static Date addMinuteTimes(int addMinutes) {
        Date currentTime = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentTime);
        calendar.add(Calendar.MINUTE, addMinutes);
        return calendar.getTime();
    }

    /**
     * 添加N秒
     * @param addSeconds
     * @return
     */
    public static Date addSecondTimes(int addSeconds) {
        Date currentTime = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentTime);
        calendar.add(Calendar.SECOND, addSeconds);
        return calendar.getTime();
    }
}
